package com.yin.springboot.favorite.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yin.springboot.favorite.entity.Fav;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author Yin
 * @since 2025-08-16
 */
public interface FavMapper extends BaseMapper<Fav> {

    @Select(" select * from fav a where " +
            " exists(select * from tag_fav b where " +
            " a.id=b.fid and b.tid=#{tid}) and a.uid=#{uid}")
    List<Fav> queryByTidAndUid(@Param("tid") int tid, @Param("uid") int uid);

}
